from odoo import models, fields, api

class QingJiaDan(models.Model):
    _name = 'qingjiadan'
    _description = '请假单'
    _inherit = ['tier.validation']  # 多级审批

    name = fields.Char(string='主题', required=True)
    employee_id = fields.Many2one('hr.employee', string='员工', required=True)
    state = fields.Selection([
        ('annual', '年假'),
        ('sick', '病假'),
        ('other', '事假')
    ], string='请假类型', required=True)
    date_from = fields.Datetime(string='开始时间', required=True)
    date_to = fields.Datetime(string='结束时间', required=True)
    reason = fields.Text(string='请假原因')
    _state_from = ['annual','sick']
    _state_to = 'other'    
    _tier_validation_manual_config = False

from odoo import api, models


class TierDefinition(models.Model):
    _inherit = "tier.definition"

    @api.model
    def _get_tier_validation_model_names(self):
        res = super()._get_tier_validation_model_names()
        res.append("qingjiadan")
        return res